package com.goodwill.androidtest.evaluate;

import com.google.gson.Gson;

public class GsonTest {
    static String jsonStr = "{\"name\":\"guoxiapjun\", \"courses\":[{\"name\":\"计算机网络\"},{\"name\":\"软件工程\"}]}";
    static String jsonStr2 = "{\"name\":\"guoxiapjun\", \"courses\":{\"name\":\"计算机网络\"}}";
    static String jsonStr3 = "{\"name\":\"guoxiapjun\", \"courses\":\"\"}";
    public static void main(String[] args) {

        Gson gson = new Gson();
        Student student = gson.fromJson(jsonStr, Student.class);

        System.out.println("deserialize: "+student.toString());
        System.out.println("serialize:"+gson.toJson(student));

    }
}
